package com.le.tester.leetcode;


/**
 * 描述：山脉数组
 */
public class MountainsArr {

    static int x = 10;

    static {
        x += 5;
    }

    public int peakIndexInMountainArray(int[] arr) {
        //获取数组的长度
        int arrLength = arr.length;
        for (int i = 0; i < arrLength; i++) {
            if (arr[0] < arr[i] && arr[i] > arr[i - 1] && arr[i] > arr[i + 1]) {
                return i;
            }
        }
        return -1;
    }


    public static void main(String[] args) {
        int[] testArr = new int[]{0, 10, 5, 2};
        MountainsArr mountainsArr = new MountainsArr();
        System.out.println(mountainsArr.peakIndexInMountainArray(testArr));
        System.out.println(x);
    }

    static {
        x /= 3;
    }
}
